<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller as BaseController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Symfony\Component\HttpKernel\Exception\HttpException;

class Controller extends BaseController {
    protected function responseWithToken($token){
        return response()->json([
            'access_token'=>$token,
            'token_type'=>'Bearer',
            'expires_in'=>Auth::guard('api')->factory()->getTTL() * 60
        ]);
    }

    public function errorResponse($statusCode,$message=null,$code=0){
        throw new HttpException($statusCode,$message,null,[],$code);
    }
}
